welcome back for another lesson also about outlier detection so as long as we can have a good statistic understanding of the outliers of your distribution then we can use the statistic method to detect and to remove your outlier and one thing we can learn is that if your data is distributed in a normal distribution or if your data satisfy a normal distribution then we can learn from how a normal distribution will have the percentage of data points distributed in certain standard deviation away from the mean approach so theoretically you will have 68% of your data fall into the mean +/- one standard deviation and 95% of your data falls into the mean +/- two standard deviations and then if you go away 3 standard deviations either go above the mean or go below the mean then you can actually cover 99.7 percentage of your data in other words you only have 0.3% of your data that should be fall into that 0.3% area because we said outliers if they are significant in terms of stats then they must be rare and uncommon which means that they may fall into that 0.3% so that is why we can use the mean and 3 standard duration away from the mean as a threshold to detect any value beyond of this range as outlier so this will be the theory background of the mean and standard deviation approach however again your data distribution must satisfy a normal distribution if your data distribution is highly skewed then you may not find out this outlier detection method will be that efficient we are going to see it from here so our setup is also quite straightforward as we have done many times we are going to import Numpy as np import pandas as pd we are going to load our dataset which is the same we just used for another outlier detection which is the Nov2Temp.CSV you can drop the file here you can upload the file here you copy the path and you paste it here so this will be our dataset and we learned that we have 118 observations 2 columns with the high temperature and the low temperature let's run the detection and we learned that for this normal distribution assumption we can use the mean and the standard deviation so actually we are going to draw one line that is the theoretical lower bound of your distribution that is your mean -  3 * standard deviation the high bound will be mean +  3 * standard deviation once we do that we can easily use these threshold as the condition to filter our data in our df low and high then we can get this result basically this detection can find out there are 3 data points beyond of the mean  +/- 3 standard deviation one thing you have to keep in mind is that the mean and standardization actually are affected by the outliers themselves because they are in the calculation of the mean they are also in a calculation of standard deviation that is why you really have to make sure that normal distribution assumption is met let's see from this box plot and we actually seen that before we have possibly 5 or more detailed points down here as outliers again the outlier is using IQR not this mean and standard evasion so it might be a little bit different in terms of the result let's remove them so we basically still use the drop and we find out all the data filtered out as satisfying as outliers we use their index to drop them we have the in place equal to True basically only these three, 109, 110, and 111 will be removed what is the result as we can see it is here so this indicates that our low bound of the low temperature is really skewed that these outliers (actually there are) are not even significant enough to be detected as the mean - 3 standard deviation again you have the practice to play with the df['high'] so that you can learn more about how to use the mean and a standard deviation as a really straightforward and easy method to detect outliers